
use "${data}IndirectSurveyDataReplication.dta", clear

********************************************************************************************************
************ CORRELATIONS BETWEEN LEADER AND HOUSEHOLD REPORTS OF SAME VARIABLE *************
********************************************************************************************************

estimates clear
xtset ejnclnmid
foreach x in jefe_secondaria personas_hogar paredes_vivienda television coche tel_movil num_ganado_mayor cuidado_bosque num_reuniones {
//Simple Correlation, f7, ¿El jefe del hogar terminó la secundaría?
reg `x'_a `x'_hh_a, cluster(ejnclnmid) nocons
estimates store `x'_1
//leader characteristics
reg `x'_a `x'_hh_a num_ejidatarios_IHS soc_cap_simple lider_edad lider_hombre lider_letrado lider_educ cargos_presidente_anos, cluster(ejnclnmid) nocons
estimates store `x'_2
//village fixed effects
xtreg `x'_a `x'_hh_a , fe i(ejnclnmid)
estimates store `x'_3
}

************ FORMAT TABLE **************************
esttab jefe_secondaria*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" ""  ) ///
	 keep(jefe_secondaria_hh_a) nonumbers  replace  fragment  ///
	 prehead({ \begin{tabular}{lccc}    ///
	 \hline \hline ///
	 & No controls & Ejidos controls & FE ejido  \\  & (1) & (2) & (3) \\   ) ///
	 posthead(\hline A: Binary variables & \\ )

esttab paredes_vivienda*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" ""   ) ///
	 keep(paredes_vivienda_hh_a)  nonumbers  append  fragment ///
	 posthead(\\ ) 
	 
esttab television*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" ""  ) ///
	 keep(television_hh_a)  nonumbers  append  fragment ///
	 posthead(\\ ) 

esttab coche*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" "" ) ///
	 keep(coche_hh_a)  nonumbers  append  fragment ///
	 posthead(\\ ) 

esttab tel_movil*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" ""  ) ///
	 keep(tel_movil_hh_a)  nonumbers  append  fragment ///
	 posthead(\\ ) 
	 
esttab cui*  ///
	 using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" ""  ) ///
	keep(cuidado_bosque_hh_a)  nonumbers  append  fragment ///
	posthead(\\ ) 

esttab num_ganado_mayor*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" "" ) ///
	 keep(num_ganado_mayor_hh_a)  nonumbers  append  fragment ///
	posthead(\hline B: Continuous variables & \\ )

 
esttab personas_hogar*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" ""  ) ///
	 keep(personas_hogar_hh_a)  nonumbers  append  fragment ///
	 posthead(\\ ) 

esttab num_reuniones*  ///
	using "${outputs}correlations.tex",  ///
	se nonotes  style(tex)  b(%12.3f) se(%12.3f)  noobs ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" "" ) ///
	 keep(num_reuniones_hh_a)  nonumbers  append   ///
	 prehead( ) ///
	  posthead(\\ ) ///
	  prefoot( \\ ) ///
	  postfoot(\hline \hline \end{tabular} } \begin{tablenotes}[para,flushleft] \footnotesize{Each row represents a different set ///
	  of regressions where the dependent variable is the reported value of the variable listed in the row by the leader. Column (1) regressions  ///
	are simple OLS with no constant.  Column 2 are OLS and include the following covariates: number of ejidatarios, leader age, leader gender, leader literacy, leader ///
	education, number of years that the leader has served the community, and whether the leader is the president or secretary. Column 3 is the fixed effects ///
	that control for village level fixed effects. Standard errors are clustered at the ejido level.* p $<$.10, ** p$<$ .05, *** p$<$.01.} \end{tablenotes} )
	  


estimates clear

